﻿using EquipSecs300.Parameter;
using SecsEquip;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EquipSecs300
{
    public class SecsDataHelper
    {
        public static string FileName_CJob = "CJob";
        public static string FileName_PJob = "PJob";

        public static DAL<List<ControlJob>> CJobListDAL;
        public static DAL<List<ProcessJob>> PJobListDAL;
        public static DAL<Dictionary<int, PortInfo>> PortInfoDAL;
        public static DAL<SecsFunction> FunctionDAL;

        public static List<ControlJob> CJobListAll = new List<ControlJob>();
        public static List<ProcessJob> PJobListAll = new List<ProcessJob>();
        public static Dictionary<int, PortInfo> PortInfo = new Dictionary<int, PortInfo>();
        public static SecsFunction Function = new SecsFunction();

        public static void InitalSetting()
        {
            CJobListDAL = new DAL<List<ControlJob>>(ParamType.CJob, "", Environment.CurrentDirectory);
            PJobListDAL = new DAL<List<ProcessJob>>(ParamType.PJob, "", Environment.CurrentDirectory);
            PortInfoDAL = new DAL<Dictionary<int, PortInfo>>(ParamType.LoadPort, "", Environment.CurrentDirectory);
            FunctionDAL = new DAL<SecsFunction>(ParamType.Function,"", Environment.CurrentDirectory);

            CJobListAll = CJobListDAL.Load();
            PJobListAll = PJobListDAL.Load();
            PortInfo = PortInfoDAL.Load();
            Function = FunctionDAL.Load();
        }

    }

    public enum ParamType
    {
        CJob=300,
        PJob,
        LoadPort,
        Function,
    }
}
